-
-
Notifications
You must be signed in to change notification settings - Fork 195
[uraflower] Week 15 Solutions #1663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전반적으로 작성하신 코드가 주석이 따로 필요 없을만큼 가독성이 좋고 깔끔하네요! 비록 사용하는 언어는 다르지만 정말 많이 배우고 갑니다 😄
15주의 긴 기간동안 정말 고생 많으셨어요! 이번 스터디를 통해 얻으신 것들을 기반으로 앞으로 희망하시는 커리어를 차곡차곡 쌓아나가시길 응원하겠습니다~! 🚀
let found = false; | ||
|
||
const minLen = Math.min(prev.length, current.length); | ||
for (let j = 0; j < minLen; j++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minLen
내 인덱스 범위에서 prev
와 current
간 문자쌍 중 처음으로 서로 다른 문자까지만 graph
에 추가해야 할 것 같은데요(그 이후 문자는 더이상 비교할 수 없기 때문), 현재 코드에서는 minLen
까지 모든 범위에 대해 graph
를 구성하고 있는 것 같아요!
그리고 현재 코드에서는 found
변수를 true
로 바꾸는 코드가 없어서 항상 false
인 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헉 제가 무료 버전에서 풀다가 실행시키려고 다른 편집기에서 작성했는데 그래서 풀다 만 버전으로 잘못 올렸네요.
꼼꼼히 봐주시고 말씀해주셔서 정말 감사합니다! 😄
} | ||
visiting.delete(current); | ||
|
||
visited.add(current); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 이 문제를 위상정렬(BFS)로 풀었는데요, DFS로 풀려면 indegree를 기록할 필요 없이 이렇게 상태를 하나 더 유지해서 풀 수 있군요! visiting
과 visited
라는 네이밍이 직관적이어서 이해하기 쉬웠습니다 🤩
queue.push(node.right); | ||
} | ||
|
||
if (isSame(node, subRoot)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BFS로 root
트리를 순회하는 동작과 재귀적으로 subRoot
트리와 비교하는 동작을 정말 깔끔하게 구현하신 것 같아요!
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!